<?php

namespace app\index\controller;

use Endroid\QrCode\QrCode;
use think\Controller;
use think\Session;
;



class Invitation extends Controller
{
    public function index()
    {
//        dump(input());
        $actid = input('id');
//        dump($actid);die;
        $refertel = Session::get('user_info')['utel'];
//	dump($refertel);die;
        $url = url('index/Activity/content',['id'=>$actid,'refertel'=>$refertel]);
//        dump($url);die;
        $qrCode = new QrCode();
        $url = 'http://www.mduncle.com'.$url;//加http://这样扫码可以直接跳转url
        $qrCode->setText($url)
            ->setSize(300)//大小
            ->setLabelFontPath(VENDOR_PATH . 'endroid/qrcode/assets/noto_sans.otf')
            ->setErrorCorrectionLevel('high')
            ->setForegroundColor(array('r' => 0, 'g' => 0, 'b' => 0, 'a' => 0))
            ->setBackgroundColor(array('r' => 255, 'g' => 255, 'b' => 255, 'a' => 0))
            ->setLabel('推广码')
            ->setLabelFontSize(16);
        header('Content-Type: ' . $qrCode->getContentType());
        echo $qrCode->writeString();
        exit;
    }
}
